<<<<<<< HEAD
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.PreparedStatement" %><%--
  Created by IntelliJ IDEA.
  User: 113
  Date: 2020/10/2
  Time: 11:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<%
  request.setCharacterEncoding("utf-8");
  String username=request.getParameter("username");
  String password=request.getParameter("password");
  //加载数据库驱动
  Class.forName("com.mysql.jdbc.Driver");
  //建立数据库连接
  String url="jbdc:mysql://10.3.22.1/book";
  Connection connection=DriverManager.getConnection(url,"root","root");

  //sql模板
  String sql="select*from user shere username =? and password =?";
  //使用PreparedStatement对象执行sql语句
  PreparedStatement ps =connection.prepareStatement(sql);

  ps.setString(1,username);
  ps.setString(2,password);

  ResultSet rs =ps.executeQuery();
  if(rs.next()){
    //表示登陆成功
    out.print("登录成功");
    //response.sendRedirect("home.jsp");
  }else {
    //表示登录不成功
    out.print("登录失败");
    //response.sendRedirect("login.jsp");
  }
%>
=======
<%--
  Created by IntelliJ IDEA.
  User: 113
  Date: 2020/10/14
  Time: 8:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
  </head>
  <body>
  $END$
  </body>
</html>
>>>>>>> origin/master
